// 该文件用于创建一个自定义指令v-have，用于对按钮进行权限限制，不展示那些没有权限的按钮
import useUserStore from "../store/modules/user";
import pinia from "../store";
const userStore = useUserStore(pinia);
export const isHaveButton = (app: any) => {
  app.directive("have", {
    mounted: (el: any, options: any) => {
      if (!userStore.buttons.includes(options.value)) {
        el.parentNode?.removeChild(el);
      }
    },
  });
};
